package de.hsmannheim.poolraumapp.fragment.util;

import android.support.v4.app.Fragment;
import android.util.Log;
import de.hsmannheim.poolraumapp.fragment.NavigationFragment;
import de.hsmannheim.poolraumapp.fragment.ResultsFragment;
import de.hsmannheim.poolraumapp.fragment.WhatFragment;
import de.hsmannheim.poolraumapp.fragment.WhenFragment;
import de.hsmannheim.poolraumapp.fragment.WhereFragment;

public class FragmentFactory {
	
	private static final String TAG = FragmentFactory.class.getName();
	
	public static Fragment createFragment(String id) {
		if (NavigationFragment.NAVIGATION_WHEN.equals(id)) {
			return new WhenFragment();
		}
		else if (NavigationFragment.NAVIGATION_WHERE.equals(id)) {
			return new WhereFragment();
		}
		else if (NavigationFragment.NAVIGATION_WHAT.equals(id)) {
			return new WhatFragment();
		}
		else if (NavigationFragment.NAVIGATION_RESULTS.equals(id)) {
			return new ResultsFragment();
		}
		Log.wtf(TAG, "Unknown fragment id " + id);
		throw new RuntimeException("Unknown fragment id " + id);
	}
}
